<template>
  <div class="FinancingSituation">
    <el-tabs v-model="activeName" style="height:100%;" type="card" class="customTabs">
      <el-tab-pane
        v-for="(item,index) in tabsList"
        :key="index + 'tabsList'"
        :label="item"
        :name="String(index)"
      >
        <div v-if="activeName == index">
          <iframe width="100%" height="100%" :src="returnUrl(index)" frameborder="0" />
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
/* eslint-disable */
import { smartBiUrl, getNowYYYYMM } from "@/util/util";
export default {
  name: "FinancingSituation",
  data () {
    return {
      tabsList: ["融资完成情况", "抵押明细", "融资合同清单", "三个月内资金计划", "资金余额表", "抵押明细（审批表）"],
      activeName: "0"
    };
  },
  created () {
    if (this.$route.query.tabs) {
      let tabs = Number(this.$route.query.tabs);
      this.activeName = String(tabs - 1);
    }
  },
  methods: {
    // eslint-disable-next-line valid-jsdoc
    /**
    * 方法描述
    * @param {Object} type 参数作用
    */
    returnUrl (type) {
      let sId = null;
      let url = '';
      let params = [{
        name: '月份',
        value: getNowYYYYMM()
      }, {
        name: '投管双首席-项目名称',
        value: this.$store.state.user.project.projectName
      }];
      switch (type) {
        case 0:
          sId = "I8a8192120174be42be42faea0174c0409fe53626";
          break;
        case 1:
          sId = "I8a8192120174be42be42faea0174c04128363652";
          break;
        case 2:
          sId = "I8a8192120174be42be42faea0174c045f32136c5";
          break;
        case 3:
          sId = "I8a8192120174be42be42faea0174c4c5275d09d1";
          break;
        case 4:
          sId = "I8a8192120174be42be42faea0174c4c5b47e09d8";
          break;
        case 5:
          sId = "I8a8192120174be42be42faea0174c4c4bb5e061a";
          break;
      }
      return smartBiUrl(sId, params);
    }

  },
  beforeDestroy () {
    let newQuery = JSON.parse(JSON.stringify(this.$route.query));
    delete newQuery.tabs
    this.$router.push({
      query: newQuery
    })
  }
};
</script>

<style lang='less' scoped>
.FinancingSituation{
  iframe{
    width: 100%;
    height: 80vh;
  }
}
</style>